<?php
session_start();
require_once('./module/verify.php');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DEMO PHOTO</title>

<script language="javascript" type="text/javascript" src="./script/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="./style/default.css"/>

<script>
	$(document).ready(function(){  
		$("#loading").ajaxStart(function(){
			$(this).fadeIn('normal');
		});
		$("#loading").ajaxStop(function(){
			$(this).fadeOut('fast');
		});  
	});
</script>
</head>

<body>

<div id="loading" class="black_full_page"><div class="loading_frame" align="center"><img src="./style/default/img_def/loading.gif" /></div></div>

<div id="frame_mash"><div id="frame_page"></div></div>


<?php
if(isset($_GET['p'])){
	$page = $_GET['p'];
}
else{
	$page = "home";
}

if(isset($_SESSION[sess_login]) && $page == 'userlogin'){
	$page = "user";
}

		switch ($page){
			case "home":	{
				$getpage = "index.html";
				break;
			}
			case "user": 	{	
				$getpage = "user/index.php";
				break;
			}
			case "photo": 	{	
				$getpage = "photo/index.php";
				break;
			}
			case "userlogin": 	{	
				$getpage = "user/user_login.php";
				break;
			}
			case "userlogout": 	{	
				$getpage = "logout.php";
				break;
			}
			default:		{
				$getpage = "index.html";
				break;
			}
					}
					
			$getpage = "./module/".$getpage;
			
?>
<!-- start menu-->
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<div id="main_menu" class="menu">
	<ul>
		<li id="user"><a href="?p=user">USER MANAGER</a></li>
		<li id="photo"><a href="?p=photo">PHOTO MANAGER</a></li>
		<?php 
		if(isset($_SESSION[sess_login])){
		echo '<li id="userlogout"><a href="?p=userlogout">Logout</a></li>';
		}
		else {
		echo '<li id="userlogin"><a href="?p=userlogin">Login</a></li>';
		}
		?>
	</ul>
</div>
<script> 		
	$('#<?=$page ?> a').addClass('menu_active');
</script>
<!--end menu-->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!--start content-->
<div id="content" class="content">
<?php
	if(file_exists($getpage)){
		include $getpage; 
	}
	else {
		echo '<center><br /><br />Trang đang truy cập không tồn tại hoặc đang xây dựng!<br /><br /><br /></center>';
	}
?>
</div>
<!--end content-->
</td></tr>
</table>
</body>
</html>
